#include "IMIUserData.h"
#include<iostream> 
#include <string> 

void IMIUserData::init(const char* pszFileName)
{
	std::string fullPath = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(pszFileName);
    unsigned char* pBuffer = NULL;
    unsigned long bufferSize = 0;
    pBuffer = CCFileUtils::sharedFileUtils()->getFileData(fullPath.c_str(), "r", &bufferSize);
	const char* p2 = static_cast<const char*>( static_cast<void*>( const_cast<unsigned char*>(pBuffer)));
	//CCLog("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$---%s",p2);
	string t1 =string(p2);
	t1.erase(0,3);
	int length=t1.size();
	//t1.erase(length-14,length);
	data=IMITool::getInstance()->stringToJson(t1);
    if (pBuffer)
    {
        delete [] pBuffer;
        pBuffer = NULL;
    }
}

IMIUserData::~IMIUserData()
{
	delete &data;
}
 